import request from "./request.js"

function getCardTitle() {
	return request.get('/api/get/title');
}

function getCard(params) {
	return request.get('api/getCardList', {
		params: params
	});
}
//上啦加载的
function addCardList(params) {
	return request.get('api/addCardList', {
		params: params
	});
}

function getCardInfo(id) {
	return request.get('api/getCardInfo', {
		params: {
			_id: id
		}
	})
}

function getLikeCard(uid) {
	return request.get('/api/getlikeCard', {
		params: {
			uid: uid
		}
	})
}

function getCollectCard(uid) {
	return request.get('/api/getfavoritesCard', {
		params: {
			uid: uid
		}
	})
}

function setHistory(userId, cardId) {
	return request.post('/api/addToWatchedHistory', {
		params: {
			userId,
			cardId
		}
	})
}

function getHistory(uid) {
	return request.get('/api/getWatchHistory', {
		params: {
			uid: uid
		}
	})
}

function postCard(params) {
	return request.post('/api/postCard', {
		params: params
	})
}

function addComment(params) {
	return request.post('/api/addComment', {
		params: params
	})
}

function getComment(id) {
	return request.get('/api/getComment', {
		params: {
			_id: id
		}
	})
}

function addLikeCard(params) {
	return request.post('/api/setLikeCard', {
		params,
	})
}

function addCollectCard(params) {
	return request.post('/api/setCollectCard', {
		params,
	})
}

function deleteCard(params) {
	return request.delete('/api/deleteCard', {
		params,
	})
}

function checkUserInteractions(params) {
	return request.get('/api/checkUserInteractions', {
		params,
	})
}

module.exports = {
	getCardTitle,
	getCard,
	getCardInfo,
	addCardList,
	getLikeCard,
	getCollectCard,
	setHistory,
	getHistory,
	postCard,
	addComment,
	getComment,
	addLikeCard,
	addCollectCard,
	deleteCard,
	checkUserInteractions

}